package com.jumper.study.admin.service.impl;

import org.springframework.stereotype.Service;
import java.util.Collection;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.jumper.study.admin.service.BannerService;
import com.jumper.study.db.dao.BannerMapper;
import com.jumper.study.db.model.Banner;

@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements BannerService {
    //批量设置上架
    @Override
    public boolean onselfBatchById(Collection<Long> ids, boolean onself) {
        LambdaUpdateWrapper<Banner> wrapper = Wrappers.lambdaUpdate();
        wrapper.set(Banner::getOnself, onself);
        wrapper.in(Banner::getId, ids);
        Integer ret = getBaseMapper().update(wrapper);
        return SqlHelper.retBool(ret);
    }
}
